#ifndef SERIALIZABLE_OUTPUT
#define SERIALIZABLE_OUTPUT

#include <vector>
#include "proto/internal.pb.h"
#include "Output.h"

class SerializableOutput {
	public:
		SerializableOutput(const Output& metadata);
		SerializableOutput(const internal::InputOperation& metadata);
		~SerializableOutput();

		void append(const Output& output, int rows);
		bool full() const;
		bool empty() const;
		const char* serializedData() const;
		int serializedLength() const;
		void clear();

		void deserialize(const char* str, int length);
		int rowsCount() const;
		const void* column(int i) const;

	private:
		// helper method for constructor
		void commonInit(const std::vector<Type>& columnTypes);

		char* data;
		char** columnBegin;
		int columnCount;
		int rowSize;
		int count;
		int fullCount;
};

#endif
